﻿<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY nbsp "&#x00A0;">
]>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:msxml="urn:schemas-microsoft-com:xslt"
	xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:TwentyTree4UmbracoLibrary="urn:TwentyTree4UmbracoLibrary"
	exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets TwentyTree4UmbracoLibrary ">


  <xsl:output method="xml" omit-xml-declaration="yes"/>

  <xsl:param name="currentPage"/>

  <xsl:variable name="videoid" select="//macro/videoid" />
  <xsl:variable name="width">
    <xsl:choose>
      <xsl:when test="string-length(//macro/width) &gt; 0">
        <xsl:value-of select="string(//macro/width)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>625</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="height">
    <xsl:choose>
      <xsl:when test="string-length(//macro/height) &gt; 0">
        <xsl:value-of select="string(//macro/height)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:text>352</xsl:text>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="domain" select="string(TwentyTree4UmbracoLibrary:GetDomain())" />
  <xsl:variable name="videos" select="TwentyTree4UmbracoLibrary:ConvertJson(concat('http://',$domain,'/js/photos?raw'))" />

  <xsl:template match="/">

    <xsl:if test="count($videos//photos [photo_id = $videoid]) &gt; 0">

      <object width="625" height="352" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" style="width:{$width}px; height:{$height}px;">
        <param name="movie" value="http://{$domain}/v.swf"></param>
        <param name="FlashVars" value="token={$videos//photos [photo_id = $videoid][1]/token}&amp;photo&#95;id={$videoid}"></param>
        <param name="allowfullscreen" value="true"></param>
        <param name="allowscriptaccess" value="always"></param>
        <embed src="http://{$domain}/v.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="625" height="352" FlashVars="token={$videos//photos [photo_id = $videoid][1]/token}&amp;photo&#95;id={$videoid}"></embed>
      </object>

    </xsl:if>


  </xsl:template>

</xsl:stylesheet>